package com.ruoyi.cs.event.supplieroffer.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

/**
 * 供应商报价
 * cs_supplier_offer
 * @author Drj 2021/6/28
 */
public class SupplierOffer extends BaseEntity {
    /**
     * 供应商报价编号
     */
    @NotNull(message = "供应商报价编号不能为空")
    @ApiModelProperty(value = "供应商报价编号", required = true)
    private String supplierQuotaId;
    /**
     * 供应商编号
     */
    @NotNull(message = "供应商编号不能为空")
    @ApiModelProperty(value = "供应商编号", required = true)
    private String supplierInfoId;
    /**
     * 供应商名称
     */
    private String supplierInfoName;
    /**
     * 经手人编号
     */
    private String staffId;
    /**
     * 经手人名称
     */
    private String staffName;
    /**
     * 预计销售总金额
     * list内金额总和
     */
    private Double purchaseExpectAmountTotal;
    /**
     * 报价时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private java.sql.Timestamp offerTime;
    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private java.sql.Timestamp createTime;
    /**
     * 备注
     */
    private String remark;
    /**
     * 供应商报价详细
     */
    List<SupplierOfferList> supplierOfferLists;

    public List<SupplierOfferList> getSupplierOfferLists() {
        return supplierOfferLists;
    }

    public void setSupplierOfferLists(List<SupplierOfferList> supplierOfferLists) {
        BigDecimal bigDecimalPEAT = new BigDecimal("0");//预计销售总金额
        for (int i = 0; i < supplierOfferLists.size(); i++) {
            bigDecimalPEAT = bigDecimalPEAT.add(new BigDecimal(supplierOfferLists.get(i).getPurchaseExpectAmount()));
        }
        setPurchaseExpectAmountTotal(bigDecimalPEAT.doubleValue());
        this.supplierOfferLists = supplierOfferLists;
    }

    public String getSupplierQuotaId() {
        return supplierQuotaId;
    }

    public void setSupplierQuotaId(String supplierQuotaId) {
        this.supplierQuotaId = supplierQuotaId;
    }

    public String getSupplierInfoId() {
        return supplierInfoId;
    }

    public void setSupplierInfoId(String supplierInfoId) {
        this.supplierInfoId = supplierInfoId;
    }

    public String getSupplierInfoName() {
        return supplierInfoName;
    }

    public void setSupplierInfoName(String supplierInfoName) {
        this.supplierInfoName = supplierInfoName;
    }

    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public String getStaffName() {
        return staffName;
    }

    public void setStaffName(String staffName) {
        this.staffName = staffName;
    }

    public Double getPurchaseExpectAmountTotal() {
        return purchaseExpectAmountTotal;
    }

    public void setPurchaseExpectAmountTotal(Double purchaseExpectAmountTotal) {
        this.purchaseExpectAmountTotal = purchaseExpectAmountTotal;
    }

    public Timestamp getOfferTime() {
        return offerTime;
    }

    public void setOfferTime(Timestamp offerTime) {
        this.offerTime = offerTime;
    }

    @Override
    public String getRemark() {
        return remark;
    }

    @Override
    public void setRemark(String remark) {
        this.remark = remark;
    }

    @Override
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }
}
